<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="fm"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>售后日志添加-</title>
<link rel="stylesheet" type="text/css" href="css/css.css" />
<style type="text/css">
#aftersaletable td {
	font-size: 16px;
	border: none !important;
}

.bbD .td {
	font-size: 16px;
	text-aign: right;
}

.btext2 .text2 {
	font-size: 16px;
	min-width: 292px;
}

.button {
	margin-top: 20px;
	font-size: 16px;
	width: 135px;
	height: 40px;
	border-radius: 20px;
	border: 1px solid #ccc;
	margin-left: 35px;
	color: #fff;
	background-color: #47a4e1
}
</style>
<script type="text/javascript" src="js/jquery.min.js"></script>
</head>
<body>
	<div id="pageAll">
		<div class="pageTop">
			<div class="page">
				<img src="img/coin02.png" /><span><a href="main.do">首页</a>&nbsp;-&nbsp;
					<a href="aftersaleinfo.do">售后管理</a>&nbsp;-</span>&nbsp;售后日志添加
			</div>
		</div>
		<div class="page ">
			<!-- 上传广告页面样式 -->
			<div class="banneradd bor">
				<form action="aftersaleadd.do" method="post"
					onsubmit="return isExsit()">
					<div class="baTopNo">
						<span>基本信息</span>
						<hr />
					</div>
					<div class="baBody">
						<table id="aftersaletable">
							<tr class="bbD">
								<td class="td">售后标题：</td>
								<td><input type="text" class="input3" name="title"
									id="title" onblur="checkTitle()" /></td>
								<td><span id="titleinfo"></span></td>
							</tr>
							<tr class="bbD">
								<td class="td">机构：</td>
								<td><select class="input3" name="oid" id="organization"
									onblur="checkOrganization()">
										<option value="">请选择机构</option>
										<c:forEach items="${sessionScope.organizations }"
											var="organization">
											<option value="${organization.id}">${organization.name }</option>
										</c:forEach>
								</select></td>
								<td><span id="organizationinfo"></span></td>
							</tr>

							<tr class="bbD">
								<td class="td">售后类型：</td>
								<td><input type="radio" name="type" value="1" id="type" />售后处理&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="type" value="2" id="type" />培训推广&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="type" value="3" id="type"
									checked="checked" />其他</td>
							</tr>
							<tr class="bbD">
								<td class="td">售后内容：</td>
								<td class="btext2"><textarea class="text2" name="content"
										id="content" onblur="checkContent()"></textarea></td>
								<td><span id="contentinfo"></span></td>
							</tr>
							<tr class="bbD">
								<td class="td">重要级别：</td>
								<td><input type="radio" name="importantlevel" value="1"
									id="importantlevel" />一般&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="importantlevel" value="2"
									id="importantlevel" />重要&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="importantlevel" value="3"
									id="importantlevel" checked="checked" />非常重要</td>
							</tr>
							<tr class="bbD">
								<td class="td">处理状态：</td>
								<td><input type="radio" name="dealstate" value="1"
									id="dealstate" />未处理&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="dealstate" value="2" id="dealstate" />处理中&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="dealstate" value="3" id="dealstate"
									checked="checked" />已处理</td>
							</tr>
							<tr class="bbD">
								<td class="td">部门：</td>
								<td><select class="input3" name="did" id="dept"
									onblur="checkDept()">
										<option value="">请选择部门</option>
										<c:forEach items="${sessionScope.depts }" var="dept">
											<option value="${dept.id}">${dept.name }</option>
										</c:forEach>
								</select></td>
								<td><span id="deptinfo"></span></td>
							</tr>
							<tr class="bbD">
								<td class="td">处理人：</td>
								<td><input type="text" class="input3" name="transactor"
									id="transactor" onblur="checkTransactor()" /></td>
								<td><span id="transactorinfo"></span></td>
							</tr>

						</table>
						<input class="button" type="submit" value="添加" /> <input
							class="button" type="reset" value="重置" />
					</div>
				</form>
			</div>

			<!-- 上传广告页面样式end -->
		</div>
	</div>
	<!-- js非空验证 -->
	<script type="text/javascript">
		function checkDept() {
			$("#deptinfo").html("");
			var dept = $("#dept").val();
			if (dept == null || "" == dept) {
				$("#deptinfo").html("部门不可以为空").css({
					color : "red"
				});
				return false;
			}
			return true;
		}
		function checkOrganization() {
			$("#organizationinfo").html("");
			var organization = $("#organization").val();
			if (organization == null || "" == organization) {
				$("#organizationinfo").html("机构不可以为空").css({
					color : "red"
				});
				return false;
			}
			return true;
		}

		function checkTitle() {
			$("#title").html("");
			var reg = /[^\x00-\x80]/;
			var transactor = $("#title").val();
			if (transactor == null || "" == transactor) {
				$("#title").html("标题不可以为空").css({
					color : "red"
				});
				return false;
			}
			return true;
		}
		function checkTitle() {
			$("#titleinfo").html("");
			var reg = /[^\x00-\x80]/;
			var title = $("#title").val();
			if (title == null || "" == title) {
				$("#titleinfo").html("标题不可以为空").css({
					color : "red"
				});
				return false;
			} else if (!reg.test(title)) {
				$("#titleinfo").html("标题必须是汉字").css({
					color : "red"
				});
				return false;
			}
			return true;
		}

		function checkTransactor() {
			$("#transactorinfo").html("");
			var reg = /[^\x00-\x80]/;
			var transactor = $("#transactor").val();
			if (transactor == null || "" == transactor) {
				$("#transactorinfo").html("处理人不可以为空").css({
					color : "red"
				});
				return false;
			} else if (!reg.test(transactor)) {
				$("#transactorinfo").html("处理人必须是汉字").css({
					color : "red"
				});
				return false;
			}
			return true;
		}

		function isExsit() {
			if (checkDept() && checkTitle()
					&& checkOrganization() && checkTransactor()) {
				return true;
			} else {
				return false;
			}
		}
	</script>
</body>
</html>